$(document).ready(function(){
	var validator = $("#frmAddCity").validate({
		
		errorElement:'div',
		rules: {
			country_id: {
				required: true
			},
			state_id: {
				required: true
			},
			cityname: {
				required: true,
				character:true,
				remote:SITEROOT+'/admin/city/checkcityexit.php'
			}			
		},
		messages: {
			country_id: {
				required: "Please select country"
			},
			state_id: {
				required: "Please select state"
			},
			cityname: {
				required: "Please enter city name",
				character: "Please enter characters only",
				remote: jQuery.format("City name already in use")
			}
		}
	
		});
		
		// this for edit city
		var validator = $("#frmEditCity").validate({
		
		errorElement:'div',
		rules: {
			country_id: {
				required: true
			},
			state_id: {
				required: true
			},
			cityname: {
				required: true,
				character:true,
				remote:SITEROOT+'/admin/city/checkcityexit.php?id='+$('#city_id').val()
			}			
		},
		messages: {
			country_id: {
				required: "Please select country"
			},
			state_id: {
				required: "Please select state"
			},
			cityname: {
				required: "Please enter city name",
				character: "Please enter characters only",
				remote: jQuery.format("City name already in use")
			}
		}
	
		});
});
